Optimal. Leaf size=179 \[ -\frac {(10 A-7 B) \tanh ^{-1}(\sin (c+d x))}{2 a^2 d}+\frac {4 (3 A-2 B) \tan (c+d x)}{a^2 d}-\frac {(10 A-7 B) \sec (c+d x) \tan (c+d x)}{2 a^2 d}-\frac {(10 A-7 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {4 (3 A-2 B) \tan ^3(c+d x)}{3 a^2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.22, antiderivative size = 179, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3057, 2827,
3852, 3853, 3855} \begin {gather*} \frac {4 (3 A-2 B) \tan ^3(c+d x)}{3 a^2 d}+\frac {4 (3 A-2 B) \tan (c+d x)}{a^2 d}-\frac {(10 A-7 B) \tanh ^{-1}(\sin (c+d x))}{2 a^2 d}-\frac {(10 A-7 B) \tan (c+d x) \sec (c+d x)}{2 a^2 d}-\frac {(10 A-7 B) \tan (c+d x) \sec ^2(c+d x)}{3 a^2 d (\cos (c+d x)+1)}-\frac {(A-B) \tan (c+d x) \sec ^2(c+d x)}{3 d (a \cos (c+d x)+a)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2827
Rule 3057
Rule 3852
Rule 3853
Rule 3855
Rubi steps
\begin {align*} \int \frac {(A+B \cos (c+d x)) \sec ^4(c+d x)}{(a+a \cos (c+d x))^2} \, dx &=-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \frac {(3 a (2 A-B)-4 a (A-B) \cos (c+d x)) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx}{3 a^2}\\ &=-\frac {(10 A-7 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {\int \left (12 a^2 (3 A-2 B)-3 a^2 (10 A-7 B) \cos (c+d x)\right ) \sec ^4(c+d x) \, dx}{3 a^4}\\ &=-\frac {(10 A-7 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}-\frac {(10 A-7 B) \int \sec ^3(c+d x) \, dx}{a^2}+\frac {(4 (3 A-2 B)) \int \sec ^4(c+d x) \, dx}{a^2}\\ &=-\frac {(10 A-7 B) \sec (c+d x) \tan (c+d x)}{2 a^2 d}-\frac {(10 A-7 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}-\frac {(10 A-7 B) \int \sec (c+d x) \, dx}{2 a^2}-\frac {(4 (3 A-2 B)) \text {Subst}\left (\int \left (1+x^2\right ) \, dx,x,-\tan (c+d x)\right )}{a^2 d}\\ &=-\frac {(10 A-7 B) \tanh ^{-1}(\sin (c+d x))}{2 a^2 d}+\frac {4 (3 A-2 B) \tan (c+d x)}{a^2 d}-\frac {(10 A-7 B) \sec (c+d x) \tan (c+d x)}{2 a^2 d}-\frac {(10 A-7 B) \sec ^2(c+d x) \tan (c+d x)}{3 a^2 d (1+\cos (c+d x))}-\frac {(A-B) \sec ^2(c+d x) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2}+\frac {4 (3 A-2 B) \tan ^3(c+d x)}{3 a^2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(609\) vs. \(2(179)=358\).
time = 4.99, size = 609, normalized size = 3.40 \begin {gather*} \frac {192 (10 A-7 B) \cos ^4\left (\frac {1}{2} (c+d x)\right ) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+\cos \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \sec (c) \sec ^3(c+d x) \left ((-6 A+45 B) \sin \left (\frac {d x}{2}\right )+(310 A-201 B) \sin \left (\frac {3 d x}{2}\right )-306 A \sin \left (c-\frac {d x}{2}\right )+195 B \sin \left (c-\frac {d x}{2}\right )+42 A \sin \left (c+\frac {d x}{2}\right )-51 B \sin \left (c+\frac {d x}{2}\right )-270 A \sin \left (2 c+\frac {d x}{2}\right )+189 B \sin \left (2 c+\frac {d x}{2}\right )+50 A \sin \left (c+\frac {3 d x}{2}\right )-B \sin \left (c+\frac {3 d x}{2}\right )+90 A \sin \left (2 c+\frac {3 d x}{2}\right )-81 B \sin \left (2 c+\frac {3 d x}{2}\right )-170 A \sin \left (3 c+\frac {3 d x}{2}\right )+119 B \sin \left (3 c+\frac {3 d x}{2}\right )+198 A \sin \left (c+\frac {5 d x}{2}\right )-129 B \sin \left (c+\frac {5 d x}{2}\right )+42 A \sin \left (2 c+\frac {5 d x}{2}\right )-9 B \sin \left (2 c+\frac {5 d x}{2}\right )+66 A \sin \left (3 c+\frac {5 d x}{2}\right )-57 B \sin \left (3 c+\frac {5 d x}{2}\right )-90 A \sin \left (4 c+\frac {5 d x}{2}\right )+63 B \sin \left (4 c+\frac {5 d x}{2}\right )+114 A \sin \left (2 c+\frac {7 d x}{2}\right )-75 B \sin \left (2 c+\frac {7 d x}{2}\right )+36 A \sin \left (3 c+\frac {7 d x}{2}\right )-15 B \sin \left (3 c+\frac {7 d x}{2}\right )+48 A \sin \left (4 c+\frac {7 d x}{2}\right )-39 B \sin \left (4 c+\frac {7 d x}{2}\right )-30 A \sin \left (5 c+\frac {7 d x}{2}\right )+21 B \sin \left (5 c+\frac {7 d x}{2}\right )+48 A \sin \left (3 c+\frac {9 d x}{2}\right )-32 B \sin \left (3 c+\frac {9 d x}{2}\right )+22 A \sin \left (4 c+\frac {9 d x}{2}\right )-12 B \sin \left (4 c+\frac {9 d x}{2}\right )+26 A \sin \left (5 c+\frac {9 d x}{2}\right )-20 B \sin \left (5 c+\frac {9 d x}{2}\right )\right )}{96 a^2 d (1+\cos (c+d x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.28, size = 222, normalized size = 1.24
method | result | size |
derivativedivides | \(\frac {\left (-10 A +7 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {-6 A +2 B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}-\frac {10 A -5 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}-\frac {2 A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{3}-\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}+9 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-7 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {6 A -2 B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\left (10 A -7 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {10 A -5 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {2 A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}}{2 d \,a^{2}}\) | \(222\) |
default | \(\frac {\left (-10 A +7 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {-6 A +2 B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}-\frac {10 A -5 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}-\frac {2 A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) A}{3}-\frac {\left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) B}{3}+9 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-7 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {6 A -2 B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\left (10 A -7 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {10 A -5 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {2 A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}}{2 d \,a^{2}}\) | \(222\) |
norman | \(\frac {\frac {\left (A -B \right ) \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}+\frac {\left (11 A -10 B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d a}-\frac {\left (19 A -12 B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}-\frac {\left (21 A -13 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d a}+\frac {\left (25 A -19 B \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}+\frac {\left (97 A -71 B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3} a}+\frac {\left (10 A -7 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 a^{2} d}-\frac {\left (10 A -7 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 a^{2} d}\) | \(243\) |
risch | \(\frac {i \left (30 A \,{\mathrm e}^{8 i \left (d x +c \right )}-21 B \,{\mathrm e}^{8 i \left (d x +c \right )}+90 A \,{\mathrm e}^{7 i \left (d x +c \right )}-63 B \,{\mathrm e}^{7 i \left (d x +c \right )}+170 A \,{\mathrm e}^{6 i \left (d x +c \right )}-119 B \,{\mathrm e}^{6 i \left (d x +c \right )}+270 A \,{\mathrm e}^{5 i \left (d x +c \right )}-189 B \,{\mathrm e}^{5 i \left (d x +c \right )}+306 A \,{\mathrm e}^{4 i \left (d x +c \right )}-195 B \,{\mathrm e}^{4 i \left (d x +c \right )}+310 A \,{\mathrm e}^{3 i \left (d x +c \right )}-201 B \,{\mathrm e}^{3 i \left (d x +c \right )}+198 A \,{\mathrm e}^{2 i \left (d x +c \right )}-129 B \,{\mathrm e}^{2 i \left (d x +c \right )}+114 A \,{\mathrm e}^{i \left (d x +c \right )}-75 B \,{\mathrm e}^{i \left (d x +c \right )}+48 A -32 B \right )}{3 a^{2} d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3}}-\frac {5 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a^{2} d}+\frac {7 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{2 a^{2} d}+\frac {5 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a^{2} d}-\frac {7 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{2 a^{2} d}\) | \(324\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 425 vs.
\(2 (169) = 338\).
time = 0.28, size = 425, normalized size = 2.37 \begin {gather*} \frac {A {\left (\frac {4 \, {\left (\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {20 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + \frac {15 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}}\right )}}{a^{2} - \frac {3 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {3 \, a^{2} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} - \frac {a^{2} \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}}} + \frac {\frac {27 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {30 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {30 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )} - B {\left (\frac {6 \, {\left (\frac {3 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {5 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}\right )}}{a^{2} - \frac {2 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} + \frac {\frac {21 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {21 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {21 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.36, size = 247, normalized size = 1.38 \begin {gather*} -\frac {3 \, {\left ({\left (10 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{5} + 2 \, {\left (10 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{4} + {\left (10 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{3}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left ({\left (10 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{5} + 2 \, {\left (10 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{4} + {\left (10 \, A - 7 \, B\right )} \cos \left (d x + c\right )^{3}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (16 \, {\left (3 \, A - 2 \, B\right )} \cos \left (d x + c\right )^{4} + {\left (66 \, A - 43 \, B\right )} \cos \left (d x + c\right )^{3} + 6 \, {\left (2 \, A - B\right )} \cos \left (d x + c\right )^{2} - {\left (2 \, A - 3 \, B\right )} \cos \left (d x + c\right ) + 2 \, A\right )} \sin \left (d x + c\right )}{12 \, {\left (a^{2} d \cos \left (d x + c\right )^{5} + 2 \, a^{2} d \cos \left (d x + c\right )^{4} + a^{2} d \cos \left (d x + c\right )^{3}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {A \sec ^{4}{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}}{\cos ^{2}{\left (c + d x \right )} + 2 \cos {\left (c + d x \right )} + 1}\, dx}{a^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.48, size = 226, normalized size = 1.26 \begin {gather*} -\frac {\frac {3 \, {\left (10 \, A - 7 \, B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {3 \, {\left (10 \, A - 7 \, B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} + \frac {2 \, {\left (30 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 15 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 40 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 18 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 9 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3} a^{2}} - \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 27 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 21 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.34, size = 203, normalized size = 1.13 \begin {gather*} \frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {2\,\left (A-B\right )}{a^2}+\frac {5\,A-3\,B}{2\,a^2}\right )}{d}-\frac {\left (10\,A-5\,B\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (8\,B-\frac {40\,A}{3}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (6\,A-3\,B\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-3\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+3\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-a^2\right )}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d}-\frac {\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (10\,A-7\,B\right )}{a^2\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________